package ysq.xyg.web.model.po;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 业务模块-交易记录实体类
 *
 * @author shengQiang yu
 * @date 2019-4-26 13:44:31
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_web_record")
public class WebRecord implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 会员id
     */ 
	@Column(name = "member_id")
	private String memberId;
	
	/**
     * 金额
     */
	@Excel(name = "交易金额",orderNum = "6")
	@Column(name = "money")
	private String money;
	
	/**
     * 类型：1、消费金额，2、收入金额
     */
	@Excel(name = "交易类型",replace = { "消费金额_1", "收入金额_2"},orderNum = "7")
	@Column(name = "type")
	private String type;
	
	/**
     * 外键id
     */
	@Excel(name = "交易编号",orderNum = "5")
	@Column(name = "extra_id")
	private String extraId;
	
	/**
     * 描述
     */
	@Excel(name = "交易描述",orderNum = "8")
	@Column(name = "descripts")
	private String descripts;
	
	/**
     * 删除标注:1、正常，2、删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建时间
     */
	@Excel(name = "交费时间", format = "yyyy-MM-dd HH:mm:ss",orderNum = "8")
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;


	/**
	 * 卡号
	 */
	@Excel(name = "会员ID",orderNum = "1")
	@Transient
	private String cardNo;

	/**
	 * 昵称
	 */
	@Excel(name = "微信昵称",orderNum = "2")
	@Transient
	private String nickName;

	/**
	 * 头像
	 */
	@Transient
	private String headImage;

	/**
	 * 手机号
	 */
	@Excel(name = "会员手机号",orderNum = "4")
	@Transient
	private String phone;

	/**
	 * 姓名
	 */
	@Excel(name = "会员名称",orderNum = "3")
	@Transient
	private String name;

	public WebRecord(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}